package com.winchain.provider;

import com.shell.bee.base.annotation.Logging;
import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.mvc.controller.BaseController;
import com.winchain.provider.msg.service.MsgTipService;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MsgTipProvider extends BaseController {
	@Autowired
	private MsgTipService msgTipService;

	@RequestMapping({ "/getMsgTip" })
	@Logging(methods = "������������")
	@ResponseBody
	public Map<String, Object> getMsgTip(String key, String cusId) throws Exception {
		Map<String, Object> map = new HashMap();
		if ((StringUtil.emptyAndNull(key)) || ("send-review".equals(key))) {
			map.put("send-review", Integer.valueOf(this.msgTipService.getMsgCountForSnd(cusId, "S001")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("receive-list".equals(key))) {
			map.put("receive-list", Integer.valueOf(this.msgTipService.getMsgCountForRcv(cusId, "S003")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("receive-aprv".equals(key))) {
			map.put("receive-aprv", Integer.valueOf(this.msgTipService.getMsgCountForRcvAprv(cusId, "S025")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("transfer-review".equals(key))) {
			map.put("transfer-review", Integer.valueOf(this.msgTipService.getMsgCountForXfe(cusId, "S006")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("discount-review".equals(key))) {
			map.put("discount-review", Integer.valueOf(this.msgTipService.getMsgCountForDct(cusId, "S013")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("receivables-review".equals(key))) {
			map.put("receivables-review", Integer.valueOf(this.msgTipService.getMsgCountForReceivable(cusId, "3")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("receivables-import-review".equals(key))) {
			map.put("receivables-import-review",
					Integer.valueOf(this.msgTipService.getMsgCountForReceivable(cusId, "0")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("receivables-mod-aprv".equals(key))) {
			map.put("receivables-mod-aprv", Integer.valueOf(this.msgTipService.getMsgCountForReceivable(cusId, "4")));
		}
		int discountTabs = 0;
		if ((StringUtil.emptyAndNull(key)) || ("discount-pay".equals(key))) {
			int discountPay = this.msgTipService.getMsgCountForDctPay(cusId);
			discountTabs += discountPay;
			map.put("discount-pay", Integer.valueOf(discountPay));
		}
		if ((StringUtil.emptyAndNull(key)) || ("discount-pre-pay".equals(key))) {
			int discountPrePay = this.msgTipService.getMsgCountForDctPrePay(cusId);
			discountTabs += discountPrePay;
			map.put("discount-pre-pay", Integer.valueOf(discountPrePay));
		}
		if ((StringUtil.emptyAndNull(key)) || ("repurchase-pmt".equals(key))) {
			map.put("repurchase-pmt", Integer.valueOf(this.msgTipService.getMsgCountForRpurPmt(cusId)));
		}
		if ((StringUtil.emptyAndNull(key)) || ("withdraw-aprv".equals(key))) {
			map.put("withdraw-aprv", Integer.valueOf(this.msgTipService.getMsgCountForWithdraw(cusId)));
		}
		if ((StringUtil.emptyAndNull(key)) || ("invoice-list-mgt".equals(key))) {
			map.put("invoice-list-mgt", Integer.valueOf(this.msgTipService.getMsgCountForInvoiceMgt(cusId, "1")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("invoice-list-operate".equals(key))) {
			map.put("invoice-list-operate", Integer.valueOf(this.msgTipService.getMsgCountForInvoiceMgt(null, "2")));
		}
		if ((StringUtil.emptyAndNull(key)) || ("activity-cus-coupon".equals(key))) {
			map.put("activity-cus-coupon", Integer.valueOf(this.msgTipService.getActivityCusCoupon(cusId)));
		}
		if ((StringUtil.emptyAndNull(key)) || ("int-conf-list".equals(key))) {
			map.put("int-conf-list", Integer.valueOf(this.msgTipService.getMsgCountForTBillPayIns(cusId)));
		}
		int dctAprvCounts = 0;
		if ((StringUtil.emptyAndNull(key)) || ("inv-aprv-list".equals(key))) {
			int count = this.msgTipService.getMsgCountForTBillAprv(cusId);
			dctAprvCounts += count;
			map.put("inv-aprv-list", Integer.valueOf(count));
		}
		int serFeeTabsCount = 0;
		if ((StringUtil.emptyAndNull(key)) || ("withhold-ser-fee-todo-list".equals(key))) {
			int count = this.msgTipService.getMsgCountForServiceFee(cusId);
			serFeeTabsCount += count;
			map.put("withhold-ser-fee-todo-list", Integer.valueOf(count));
		}
		if ((StringUtil.emptyAndNull(key)) || ("ser-fee-tabs".equals(key))) {
			map.put("ser-fee-tabs", Integer.valueOf(serFeeTabsCount));
		}
		if ((StringUtil.emptyAndNull(key)) || ("loan-list".equals(key))) {
			int count = this.msgTipService.getMsgCountForTBillPayConfirm(cusId);
			discountTabs += count;
			map.put("loan-list", Integer.valueOf(count));
		}
		if ((StringUtil.emptyAndNull(key)) || ("discount-aprv-list".equals(key))) {
			int count = this.msgTipService.getMsgCountForBillDctApprove(cusId);
			dctAprvCounts += count;
			map.put("discount-aprv-list", Integer.valueOf(count));
		}
		if ((StringUtil.emptyAndNull(key)) || ("aprv-list".equals(key))) {
			map.put("aprv-list", Integer.valueOf(dctAprvCounts));
		}
		if ((StringUtil.emptyAndNull(key)) || ("discount-pmt-tabs".equals(key))) {
			map.put("discount-pmt-tabs", Integer.valueOf(discountTabs));
		}
		int discountList = 0;
		if ((StringUtil.emptyAndNull(key)) || ("discount-list".equals(key))) {
			discountList = this.msgTipService.getCountForBillDctUnuploadInvoice(cusId);
			map.put("discount-list", Integer.valueOf(discountList));
		}
		if ((StringUtil.emptyAndNull(key)) || ("discount-unupload-invoice-list".equals(key))) {
			map.put("discount-unupload-invoice-list", Integer.valueOf(discountList));
		}
		int tbillBiscountList = 0;
		if ((StringUtil.emptyAndNull(key)) || ("inv-unupload-invoice-list".equals(key))) {
			tbillBiscountList = this.msgTipService.getCountForTBillDctUnuploadInvoice(cusId);
			map.put("inv-unupload-invoice-list", Integer.valueOf(tbillBiscountList));
		}
		if ((StringUtil.emptyAndNull(key)) || ("comm-inv-list".equals(key))) {
			map.put("comm-inv-list", Integer.valueOf(tbillBiscountList));
		}
		if ((StringUtil.emptyAndNull(key)) || ("dis-inv-aprv-list".equals(key))) {
			map.put("dis-inv-aprv-list", Integer.valueOf(this.msgTipService.getMsgCountForInvoiceAprv(cusId)));
		}
		if ((StringUtil.emptyAndNull(key)) || ("comm-inv-review".equals(key))) {
			map.put("comm-inv-review", Integer.valueOf(this.msgTipService.getMsgCountForTBillRev(cusId)));
		}
		return map;
	}
}
